package org.jleaf.springcloud.webui;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 *  模拟前端页面去调用后端的微服务
 *
 * @author yaoshuhong
 * @date 2016-08-03 15:28
 */
@SpringBootApplication
@EnableDiscoveryClient//启动服务自动注册
@EnableFeignClients//启动feign
@EnableCircuitBreaker//启动Hystrix断路器,也可以使用@EnableHystrix
public class WebUIApplication {

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(WebUIApplication.class, args);
    }

}
